<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    function P1(name,age) {
        this.name = name;
        this.age = age;
    }
    var cc = new P1("cc",19)
    console.log(cc);
    
    var mm = new P1("mm",19)
    console.log(mm)
    
    //需求 不需要new就可以获取就可以得到p1实例对象
    function $(name,age) {
        return new P1(name,age)
    }
    var xx = $("xx",19)
    console.log(xx)

    </script>
</body>
</html>